//
//  main.m
//  VCF
//
//  Created by mac on 16-6-16.
//  Copyright (c) 2016年 1511. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        NSString *path=@"/Users/mac/Desktop/00002.vcf";
        NSError *err;
        NSString *vcf = [[NSString alloc]initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&err];
        NSLog(@"%@",vcf);
        
        NSArray *arr=[vcf componentsSeparatedByString:@"\n"];
        
        for (NSString *line in arr)
        {
            if ([line hasPrefix:@"FN"])
            {
                NSArray *arr = [line componentsSeparatedByString:@":"];
                NSString *str = arr[1];
                str = [str stringByReplacingOccurrencesOfString:@"=" withString:@"%"];
                str = [str stringByRemovingPercentEncoding];
                NSLog(@"%@",str);
            }
            if([line hasPrefix:@"TEL"])
            {
                NSArray *arr = [line componentsSeparatedByString:@":"];
                NSLog(@"%@",arr[1]);
            }
        }
    }
    return 0;
}

